﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using DataAccessClasses;

namespace BOGolf
{
    class registration
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _regid = -99;
        private string _fname = "";
        private string _lname = "";
        private string _password = "";
        private long _phone = -99;
        private string _email = "";
        private string _address = "";
        private string _city = "";
        private string _state = "";
        private long _zip = -99;
        private string _country = "";
        private bool _isdeleted = false;

        public long regid
        {
            get
            {
                return _regid;
            }
            set
            {
                _regid = value;
            }
        }
        public string fname
        {
            get
            {
                return _fname;
            }
            set
            {
                _fname = value;
            }
        }
        public string lname
        {
            get
            {
                return _lname;
            }
            set
            {
                _lname = value;
            }
        }
        public string password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
            }
        }
        public long phone
        {
            get
            {
                return _phone;
            }
            set
            {
                _phone = value;
            }
        }
        public string email
        {
            get
            {
                return _email;
            }
            set
            {
                _email = value;
            }
        }
        public string address
        {
            get
            {
                return _address;
            }
            set
            {
                _address = value;
            }
        }
        public string city
        {
            get
            {
                return _city;
            }
            set
            {
                _city = value;
            }
        }
        public string state
        {
            get
            {
                return _state;
            }
            set
            {
                _state = value;
            }
        }
        public long zip
        {
            get
            {
                return _zip;
            }
            set
            {
                _zip = value;
            }
        }
        public string country
        {
            get
            {
                return _country;
            }
            set
            {
                _country = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@regid", regid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@fname", fname, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@lname", lname, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@phone", phone, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@email", email, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@address", address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@city", city, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@state", state, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@zip", zip, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@country", country, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11 };
                return DAC.Save("registration_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }

        public DataTable GetRecords(long regid,string fname,string lname,string password, long phone, string email,string address,string city,string state,long zip,string country,bool isdeleted, string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@regid", regid, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@fname", fname, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@lname", lname, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@phone", phone, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@email", email, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@address", address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@city", city, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@state", state, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@zip", zip, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@country", country, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11, dbparam11 };
                DataTable dt1= DAC.Select("registration_get",dbparamcall);    
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}

